/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.mycompany;

import com.einstein.domain.Cliente;
import java.util.ArrayList;
import javax.ejb.EJB;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.enterprise.context.SessionScoped;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceUnit;

/**
 *
 * @author Tobe
 */
@Stateless
@LocalBean
public class ClienteService {
    
    //@PersistenceUnit(unitName = "com.mycompany_Einstein-web_war_1.0-SNAPSHOTPU")
    //private EntityManagerFactory emf;
    

    //EntityManager em;
    
    /*public EntityManager getEntityManager() {
        this.em = emf.createEntityManager();
        return em;          
    }*/
    
    public ArrayList<Cliente> listarClientes(){
        ArrayList<Cliente> list = new ArrayList<>();
                
        Cliente c = new Cliente();        
        c.setNombre("Alberto Chaves Villegas");
        c.setCedula("112810309");
        
        Cliente c2 = new Cliente();
        c2.setNombre("Angela Chaves Villegas");
        c2.setCedula("206260245");
        
        //getEm().persist(c);       
        //seg.setUsuario("ajchv23"); 
        
        //em.persist(c); 
        
        list.add(c);
        list.add(c2);
        
        
        return list;
        
        //return (ArrayList<Cliente>) em.createQuery("select c from Cliente c").getResultList();
        //return (ArrayList<Cliente>) em.createNativeQuery("select * from tsl_cliente").getResultList();
    }
    
    
}
